Skip to content

fix: Correctly query message on CreateUserTokenError union#3997

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graphql-create-user-token-error
Open

fix: Correctly query message on CreateUserTokenError union#3997
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graphql-create-user-token-error

Conversation

@sentry

@sentry sentry Bot commented Jun 8, 2026

Copy link
Copy Markdown

Description

This PR addresses a GraphQLError: Cannot query field 'message' on type 'CreateUserTokenError' that occurs when attempting to query the message field directly on the CreateUserTokenError union type.

The root cause is that CreateUserTokenError is a GraphQL union (UnauthenticatedError | ValidationError), and fields cannot be queried directly on union types. All member types of this union, however, implement the ResolverError interface, which exposes the message field.

Code Example

mutation CreateUserToken($input: CreateUserTokenInput!) {
  createUserToken(input: $input) {
    error {
      ... on ResolverError {
        message
      }
    }
    token {
      token
    }
  }
}

Notable Changes

The fix updates the createUserToken mutation query in src/services/access/useGenerateUserToken.ts to use an inline fragment ... on ResolverError { message }. This correctly retrieves the error message when an error occurs, resolving the GraphQL validation error and aligning the frontend query with the backend schema. It also ensures that the existing Zod schema, which expects a message field, is correctly populated.

Screenshots

Link to Sample Entry

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes API-E9F

@sentry

sentry Bot commented Jun 8, 2026

Copy link
Copy Markdown
Author

Bundle Report

Changes will increase total bundle size by 112 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-esm 5.96MB 56 bytes (0.0%) ⬆️
gazebo-production-system 5.87MB 56 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 56 bytes 9.51kB 0.59%

Files in assets/index-legacy.*.js:

  • ./src/services/access/useGenerateUserToken.ts → Total Size: 1.57kB
view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 56 bytes 9.63kB 0.58%

Files in assets/index.*.js:

  • ./src/services/access/useGenerateUserToken.ts → Total Size: 1.57kB

@sentry

sentry Bot commented Jun 8, 2026

Copy link
Copy Markdown
Author

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.73%. Comparing base (b33c3d9) to head (8b63a8e).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3997   +/-   ##
=======================================
  Coverage   98.73%   98.73%           
=======================================
  Files         827      827           
  Lines       15133    15133           
  Branches     4357     4365    +8     
=======================================
  Hits        14942    14942           
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
src/services/access/useGenerateUserToken.ts 93.75% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.37% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.95% <ø> (ø)
UI 99.01% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b33c3d9...8b63a8e. Read the comment docs.

@codecov-notifications

codecov-notifications Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3997   +/-   ##
=======================================
  Coverage   98.73%   98.73%           
=======================================
  Files         827      827           
  Lines       15133    15133           
  Branches     4357     4357           
=======================================
  Hits        14942    14942           
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
src/services/access/useGenerateUserToken.ts 93.75% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.37% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.95% <ø> (ø)
UI 99.01% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b33c3d9...8b63a8e. Read the comment docs.

@codecov-public-qa

codecov-public-qa Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.73%. Comparing base (b33c3d9) to head (8b63a8e).

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3997   +/-   ##
=======================================
  Coverage   98.73%   98.73%           
=======================================
  Files         827      827           
  Lines       15133    15133           
  Branches     4357     4357           
=======================================
  Hits        14942    14942           
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
src/services/access/useGenerateUserToken.ts 93.75% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.37% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.95% <ø> (ø)
UI 99.01% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b33c3d9...8b63a8e. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codecov-releaser

Copy link
Copy Markdown
Collaborator

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
8b63a8e Mon, 08 Jun 2026 09:54:55 GMT Cloud Enterprise

@codecov-qa

codecov-qa Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.73%. Comparing base (b33c3d9) to head (8b63a8e).

@@           Coverage Diff           @@
##             main    #3997   +/-   ##
=======================================
  Coverage   98.73%   98.73%           
=======================================
  Files         827      827           
  Lines       15133    15133           
  Branches     4357     4357           
=======================================
  Hits        14942    14942           
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
src/services/access/useGenerateUserToken.ts 93.75% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.37% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.95% <ø> (ø)
UI 99.01% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b33c3d9...8b63a8e. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant